package org.tysite.tyservice.example.validation.dto;

import org.tysite.tyservice.example.validation.group.ModifyOperation;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @Validated 分组功能验证
 * @author tysite
 * @date 2020/3/22 0022 15:10
 */
public class GroupDemoDTO implements Serializable {
    private static final long serialVersionUID = 2273575891471327661L;
    
    @NotNull(message = "编辑操作ID不能为空", groups = ModifyOperation.class)
    private Integer id;
    
    @NotBlank(message = "名称不能为空")
    @Size(max = 50, message = "名称长度必须在1~50之间")
    private String name;
    
    public Integer getId() {
        return id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Override
    public String toString() {
        return "GroupDemoDTO{" +
            "id=" + id +
            ", name='" + name + '\'' +
            '}';
    }
}
